﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class VerifyStaffs : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Get the session state to display related content
        m_MainPage = (KaohePage)Page;
        //Get title from main logic

        //Label_Title = m_MainPage.MainLogic.GetContentTitle();

        string curUserName = (string)Session[Engine.m_Usnkey];
        //get dpt by curUserName

        ObjectDataSource_Staff.SelectParameters["Verifier"].DefaultValue = curUserName;

    }

    private KaohePage m_MainPage = null;
    private DataComponent m_dc = new DataComponent();
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {

    }
    protected void ObjectDataSource_Webservice_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        IDictionary paramsFromPage = e.InputParameters;

    }
    protected void ObjectDataSource_Webservice_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        IDictionary paramsFromPage = e.InputParameters;
    }
    protected void GridView_DptStaffs_DataBound(object sender, EventArgs e)
    {

    }
    protected void GridView_DptStaffs_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string leaderSN = (string)Session[Engine.m_Usnkey];
        string curSN = e.Row.Cells[0].Text;
        if (curSN == leaderSN)
        {
            e.Row.Visible = false;
        }

        Utility.FormatGridview(GridView_DptStaffs, e);
    }
    protected void GridView_DptStaffs_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        if (Utility.HasNullValue(e.NewValues))
        {
            ((Label)Page.Master.FindControl("ErrorLabel")).Text = "输入不能为空！";
            e.Cancel = true;
            return;
        }

        string score = e.NewValues["ScoreByLeader"].ToString();
        // Set the error message label.
        if (!Utility.IsValidScore(score))
        {
            ((Label)Page.Master.FindControl("ErrorLabel")).Text = "请确定评分在0~100之间.";
            e.Cancel = true;
        }
        else
            ((Label)Page.Master.FindControl("ErrorLabel")).Text = "";
    }
}
